package ru.evga.gwt.lib.common.client.view;

import ru.evga.gwt.lib.common.client.domain.BaseEntityDto;

import com.google.gwt.editor.client.HasEditorErrors;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver;


public interface IEntityEditView<P extends BaseEntityDto, V extends IEntityEditView<P, V>>
    extends IsWidget, HasEditorErrors<P>
{
    /**
     * @return a new {@link RequestFactoryEditorDriver} initialized to run this
     *         editor
     */
    RequestFactoryEditorDriver<P, V> createEditorDriver();

    /**
     * Implemented by the owner of the view.
     */
    interface Delegate
    {
        void cancelClicked();

        void saveClicked();
    }

    void setDelegate(Delegate delegate);

    void setEnabled(boolean b);
}
